﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class Student
{
    const string DATE_TIME_FORMAT = "dd.MM.yyyy";

    private byte age;
    private string gender;
    private string name;
    private byte classNumber;
    private int ssn;
         
    public byte Age
    {
        get { return age; }
        set { age = value; }
    }

    public string Gender
    {
        get { return gender; }
        set { gender = value; }
    }

    public string Name
    {
        get { return name; }
        set { name = value; }
    }

    public byte ClassNumber
    {
        get { return classNumber; }
        set { classNumber = value; }
    }
    
    public int Ssn
    {
        get { return ssn; }
        set { ssn = value; }
    }
    
    public Student(byte age, string gender, string name, byte classNumber, int ssn)
    {
        if (age < 7 || age > 18)
        {
            throw new InvalidStudentException(String.Format("Age must be between [7..18] not {0} allowed", age));
        }
        else
        {
            this.age = age;
        }

        if (!gender.Equals("male") && !gender.Equals("female"))
        {
            throw new InvalidStudentException(String.Format("Gender must be 'male' or 'female' not '{0}'",gender));
        }
        else
        {
            this.gender = gender;
        }

        if (name.Length < 10 || name.Length > 50)
        {
            throw new InvalidStudentException(String.Format("Name must be between 10 and 50 characters not {0}",name.Length));
        }
        else
        {
            this.name = name;
        }

        if (classNumber < 1 || classNumber > 11)
        {
            throw new InvalidStudentException(String.Format("Class should be between [1..11] not {0}",classNumber));
        }
        else
        {
            this.classNumber = classNumber;
        }

        if (ssn.ToString().Length != 9)
        {
            throw new InvalidStudentException(String.Format("Social security number must be 9 digits, not {0}",
                ssn.ToString().Length));
        }        
    }

}

